# class DB():
#     def __init__(self, host, user, password, database, cursorclass):
#         self.host = host
#         self.user = user
#         self.password = password
#         self.databases = database
#         self.cursorclass = cursorclass
#     def connect(self):
#         import pymysql
#         self.db = pymysql.connect(host=self.host, user=self.user,
#                                       password=self.password, database=self.databases, cursorclass=self.cursorclass)
#         self.cursor = self.db.cursor()
#     def close(self):
#         self.cursor.close()
#         self.db.close()
#     def select_one(self, sql):
#         self.connect()
#         try:
#             self.cursor.execute(sql)
#             result = self.cursor.fetchone()
#             self.close()
#         except Exception as e:
#             print("select error",e)
#             result = None
#         return result
#     def select_all(self,sql):
#         self.connect()
#         try:
#             self.cursor.execute(sql)
#             result = self.cursor.fetchall()
#             self.close()
#         except Exception as e:
#             print("select error ",e)
#             result = None
#         return result
#     def __edit(self, sql):
#         self.connect()
#         try:
#             self.cursor.execute(sql)
#             self.db.commit()
#             result = "数据库更新成功"
#         except Exception as e:
#             result = "数据库更新失败" % e
#         return result
#     def insert(self, sql):
#         return self.__edit(sql)
#     def delete(self, sql):
#         return self.__edit(sql)
#     def update(self, sql):
#         return self.__edit(sql)
#
# db1 = DB(host="47.92.155.202", user="root", password="123456", database="test",
#              cursorclass=pymysql.cursors.DictCursor)
# db1.insert("insert into student1(name) values('小花');")
# db1.delete("delete from student1 where id =1;")
# db1.update("update student1 set id = 1 where id =2;")
# print(db1.select_one('select * from student1;'))



# 二、交通工具
# 1.请定义一个交通工具(Vehicle)的类，其中有:
# ⦁ 属性：速度(speed)，体积(size)等
# ⦁ 方法：移动(move())，设置速度(setSpeed(int speed))，设置体积（setSize(int size)）加速speedUp(),减速speedDown()等
# 在测试类Vehicle中的main()中实例化一个交通工具对象，通过方法给它初始化speed,size的值，并打印出来。另外，调用加速，减速的方法对速度进行改变。

# class Vehicle():
#     def __init__(self,speed,size):
#         self.speed = speed
#         self.size = size
#
#     def move(self,fx):
#         if fx=="前":
#             return "向前行驶{}".format(self.fx)
#         elif fx=="后":
#             return "向后行驶{}".format(self.fx)
#     def setSize(self,sz):
#         self.size+=sz
#         return "体积变{}".format(self.sz)
#     def setSpeed(self,speed):
#         self.speed+=speed
#         return"速度变{}".format(self.speed)
#     def speedUp(self,speed):
#         if speed>0:
#             self.speed+=speed
#             return"加速".format(self.speed)
#         else:
#             return "没有变化"
#
#     def speedDown(self,speed):
#         if speed<0:
#             self.speed+=speed
#             return"减速".format(self.speed)
#         else:
#             return "没有变化"
# v1=Vehicle(60,8)
# print(Vehicle.setSize(8))









# 三、封装学"生信息管理系统
# 学生信息包括：学号，姓名，年龄，性别，出生年月，地址，电话，E-mail
#     功能：1.系统以菜单方式工作
#         2.学生信息录入功能（文件）
#         3.学生信息浏览
#         4.查询排序功能
#             1）学号排序
#             2）姓名排序
#         5.信息删改
#
import pymysql
# class student():
#     def __init__(self):
#         self.list1 =[]
#     def add (self,id,name,age,six,birthday,address,phone,Email):
#         self.list1.append({"学号":id,"姓名":name,"性别":six,"生日":birthday,"地址":address,"电话":phone,"邮箱":Email})
#     def show(self):
#         self.list1
#     def paixu(self,num):
#         self.list1[num-1].sort(reverse= True)
#     def paixu(self,num):
#         self.list1[num-1].sort(reverse=False)
#     def update

#     self.id = id
#     self.name =name
#     self.age =age
#     self.six =six
#     self.birthday =birthday
#     self.address =address
#     self.phone =phone
#     self.Email =Email
# def __str__(self):
#     return ""










# 四、点餐管理系统
# 餐馆
# 1、餐馆可以新增菜品、下架菜品、修改菜品
# 2、每个菜品，都有对应的库存，所有菜品的库存均为999，每出一道菜，库存-1。
# 菜品有对应的价格，餐厅老板定义价格每道菜不允许超过15元，没有小数单位，均为整数
# 3、餐馆后台有点赞系统，能够收集客户对菜品的喜好，0~5分
# 4、有菜品评分提报功能，对平均分数（菜品总分/打分人数）低于3分的菜品进行强制下架；

# 客户端
# 1、客户可以进行点餐
# 2、每个客户的起始钱包均为200，订餐后扣减对应金额
# 3、可以为每个菜进行打分


# class food():
#     def __init__(self):
#         self.list1 =[]
#     def add(self,num):
#         self.list1.append(num)
#     def delete(self):